fix: status card for request changes and validation for new join steps#1151
fix: status card for request changes and validation for new join steps#1151MayankBansal12 wants to merge 4 commits intodevelopfrom
Conversation
Summary by CodeRabbit
WalkthroughThis PR extends the application management flow by introducing a "changes_requested" status for handling application revisions, adding automatic role prefilling during onboarding, refactoring form field validation logic, and updating navigation to redirect to application detail pages instead of the join route. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying www-rds with
|
| Latest commit: |
6291200
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://05dcd081.www-rds.pages.dev |
| Branch Preview URL: | https://refactor-create-application.www-rds.pages.dev |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/components/new-join-steps/new-step-one.js`:
- Around line 58-65: The code assumes any existing userRole maps to a key and
sets isRoleAvailable true even when unmapped; change the logic in the block that
uses userRole/USER_ROLE_MAP so you first compute roleKey (from
Object.keys(USER_ROLE_MAP).find(...)) and then only call
this.updateFieldValue('role', roleKey) and set this.isRoleAvailable = true when
roleKey is defined (non-undefined); if roleKey is undefined, do not call
updateFieldValue and ensure this.isRoleAvailable remains false so role buttons
are not disabled. Also keep the checks around this.login.userData?.role
(userRole) as-is.
In `@app/components/new-stepper.js`:
- Around line 171-175: The redirect currently reads applicationId from
data.applicationId and always sets queryParams.dev=true; change it to pull the
id from the nested payload (use data?.application?.id ??
this.onboarding.applicationData?.id) and make queryParams conditional (e.g.
const query = data?.dev ? { dev: true } : {}), then call
this.clearAllStepData(); this.router.transitionTo('applications.detail',
applicationId, { queryParams: query }); update usage around applicationId,
clearAllStepData, and router.transitionTo accordingly.
ℹ️ Review info
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (19)
app/components/join-steps/status-card.hbsapp/components/join-steps/status-card.jsapp/components/new-join-steps/base-step.jsapp/components/new-join-steps/new-step-one.hbsapp/components/new-join-steps/new-step-one.jsapp/components/new-stepper.jsapp/components/signup-steps/step-zero.hbsapp/components/signup-steps/step-zero.jsapp/constants/join.jsapp/constants/new-join-form.jsapp/constants/new-signup.jsapp/constants/urls.jsapp/controllers/goto.jsapp/controllers/join.jsapp/styles/new-stepper.module.csstests/integration/components/new-join-steps/new-step-one-test.jstests/integration/components/new-signup/info-test.jstests/integration/components/new-stepper-test.jstests/integration/components/signup-steps/step-zero-test.js
| const userRole = this.login.userData?.role; | ||
| if (userRole) { | ||
| const roleKey = Object.keys(USER_ROLE_MAP).find( | ||
| (key) => USER_ROLE_MAP[key] === userRole, | ||
| ); | ||
| this.updateFieldValue('role', roleKey); | ||
| this.isRoleAvailable = true; | ||
| } |
There was a problem hiding this comment.
Guard unmapped profile roles before disabling role selection.
If userRole exists but has no match in USER_ROLE_MAP, Line 63 writes undefined and Line 64 still sets isRoleAvailable = true. That disables all role buttons without selecting a valid role.
Suggested fix
const userRole = this.login.userData?.role;
if (userRole) {
const roleKey = Object.keys(USER_ROLE_MAP).find(
(key) => USER_ROLE_MAP[key] === userRole,
);
- this.updateFieldValue('role', roleKey);
- this.isRoleAvailable = true;
+ if (roleKey) {
+ this.updateFieldValue('role', roleKey);
+ this.isRoleAvailable = true;
+ }
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const userRole = this.login.userData?.role; | |
| if (userRole) { | |
| const roleKey = Object.keys(USER_ROLE_MAP).find( | |
| (key) => USER_ROLE_MAP[key] === userRole, | |
| ); | |
| this.updateFieldValue('role', roleKey); | |
| this.isRoleAvailable = true; | |
| } | |
| const userRole = this.login.userData?.role; | |
| if (userRole) { | |
| const roleKey = Object.keys(USER_ROLE_MAP).find( | |
| (key) => USER_ROLE_MAP[key] === userRole, | |
| ); | |
| if (roleKey) { | |
| this.updateFieldValue('role', roleKey); | |
| this.isRoleAvailable = true; | |
| } | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@app/components/new-join-steps/new-step-one.js` around lines 58 - 65, The code
assumes any existing userRole maps to a key and sets isRoleAvailable true even
when unmapped; change the logic in the block that uses userRole/USER_ROLE_MAP so
you first compute roleKey (from Object.keys(USER_ROLE_MAP).find(...)) and then
only call this.updateFieldValue('role', roleKey) and set this.isRoleAvailable =
true when roleKey is defined (non-undefined); if roleKey is undefined, do not
call updateFieldValue and ensure this.isRoleAvailable remains false so role
buttons are not disabled. Also keep the checks around this.login.userData?.role
(userRole) as-is.
Date: 27-02-26
Developer Name: @MayankBansal12
Issue Ticket Number:-
Description:
Is Under Feature Flag
Database changes
Breaking changes (If your feature is breaking/missing something please mention pending tickets)
Is Development Tested?
Tested in staging?
Add relevant Screenshot below ( e.g test coverage etc. )
screencast